var pageii = null;
var grid = null;
$(function() {
	grid = lyGrid({
		id : 'paging',
		l_column : [ {
			colkey : "title",
			name : "标题",
		}, {
			colkey : "tag",
			name : "标签"
		},{
			colkey : "createtime",
			name : "发布时间",
			width : "150px"
		}],
		jsonUrl : rootPath + '/admin/findArticleByPage.shtml',
		checkbox : true,
		serNumber : true
	});
	$("#addFun").click("click", function() {
		addAccount();
	});
	$("#delFun").click("click", function() {
		delAccount();
	});
});


function show(id){
		pageii = layer.open({
			title : "编辑",
			type : 2,
			area : [ "800px", "80%" ],
			content : rootPath + '/admin/editUI.shtml?id=' + id
		});
}

function addAccount(){
	pageii = layer.open({
		title : "编辑",
		type : 2,
		area : [ "800px", "80%" ],
		content : rootPath + '/admin/editUI.shtml'
	});
}

function delAccount() {
	var cbox = grid.getSelectedCheckbox();
	if (cbox == "") {
		layer.msg("请选择删除项！！");
		return;
	}
	layer.confirm('是否删除？', function(index) {
		var url = rootPath + '/admin/deleteEntity.shtml';
		var s = CommnUtil.ajax(url, {
			ids : cbox.join(",")
		}, "json");
		if (s == "success") {
			layer.msg('删除成功');
			grid.loadData();
		} else {
			layer.msg('删除失败');
		}
	});
}